home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / BlazingBoard / BlazingBoard.jar / Engine.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-01-29  |  20.9 KB  |  1,253 lines

  1. import javax.microedition.lcdui.Canvas;
  2. import javax.microedition.lcdui.Displayable;
  3. import javax.microedition.lcdui.Graphics;
  4. import javax.microedition.lcdui.Image;
  5.  
  6. public final class Engine extends Canvas implements Runnable {
  7.    private Image imageBuffer;
  8.    private Graphics imageBufferGraphics;
  9.    boolean flag_repaint = true;
  10.    boolean suspend = true;
  11.    String screen_message;
  12.    long message_time;
  13.    long now_time;
  14.    private int getKeyCode_LEFT;
  15.    private int getKeyCode_RIGHT;
  16.    private int getKeyCode_UP;
  17.    private int getKeyCode_FIRE;
  18.    final String[] st_m = new String[]{"GO!", "1", "2", "3"};
  19.    private int position_across;
  20.    private int position_along;
  21.    private int height;
  22.    private int height_relative;
  23.    private int current_trick;
  24.    private int current_frame;
  25.    private int n_blaze_letters;
  26.    long time_left_on_finish;
  27.    private boolean on_fire = false;
  28.    int arrow_pressed;
  29.    int velocity_across;
  30.    int velocity_vertical;
  31.    int g_force = 6;
  32.    boolean is_goofy;
  33.    boolean below_is_rail;
  34.    boolean below_is_ramp;
  35.    int below_item_height;
  36.    boolean high_jump_board;
  37.    boolean after_finish;
  38.    int tick;
  39.    int countDown;
  40.    long game_start_time;
  41.    long game_freeze_time;
  42.    long game_timeout;
  43.    private BestScore best_score;
  44.    private int first_item_num;
  45.    private int last_item_num;
  46.  
  47.    public Engine() {
  48.       this.best_score = BlazingBoards.best_score;
  49.       this.imageBuffer = Image.createImage(101, 80);
  50.       this.imageBufferGraphics = this.imageBuffer.getGraphics();
  51.       ((Displayable)this).addCommand(BlazingBoards.allCommand[1]);
  52.       ((Displayable)this).addCommand(BlazingBoards.allCommand[5]);
  53.       ((Displayable)this).setCommandListener(BlazingBoards.app);
  54.       System.out.println("create engine");
  55.       this.startNewGame();
  56.       (new Thread(this)).start();
  57.       this.getKeyCode_LEFT = ((Canvas)this).getKeyCode(2);
  58.       this.getKeyCode_RIGHT = ((Canvas)this).getKeyCode(5);
  59.       this.getKeyCode_UP = ((Canvas)this).getKeyCode(1);
  60.       this.getKeyCode_FIRE = ((Canvas)this).getKeyCode(8);
  61.    }
  62.  
  63.    public void paint(Graphics var1) {
  64.       var1.drawImage(this.imageBuffer, 0, 0, 20);
  65.       this.flag_repaint = false;
  66.    }
  67.  
  68.    public void showNotify() {
  69.       System.out.println("engine show" + ((Displayable)this).isShown());
  70.       this.suspend = false;
  71.       this.arrow_pressed = 0;
  72.       if (!this.after_finish) {
  73.          long var1 = System.currentTimeMillis();
  74.          this.game_start_time += var1 - this.now_time;
  75.          this.now_time = var1;
  76.       }
  77.  
  78.    }
  79.  
  80.    public void hideNotify() {
  81.       System.out.println("engine  hide" + ((Displayable)this).isShown());
  82.       this.suspend = true;
  83.    }
  84.  
  85.    public void run() {
  86.       while(BlazingBoards.app != null) {
  87.          try {
  88.             if (this.suspend) {
  89.                if (((Displayable)this).isShown()) {
  90.                   this.showNotify();
  91.                } else {
  92.                   System.gc();
  93.                   Thread.sleep(100L);
  94.                }
  95.             } else {
  96.                this.now_time = System.currentTimeMillis();
  97.                if (this.countDown > 0) {
  98.                   if (this.now_time - this.game_start_time > 1000L) {
  99.                      this.game_start_time = this.now_time;
  100.                      --this.countDown;
  101.                      this.set_screen_message(this.st_m[this.countDown]);
  102.                      this.flag_repaint = true;
  103.                   }
  104.                } else {
  105.                   long var1 = this.now_time - this.game_start_time;
  106.                   int var3 = (int)(var1 / 160L);
  107.                   if (var3 > this.tick) {
  108.                      this.tick = var3;
  109.                      this.nextTick();
  110.                      if (this.after_finish) {
  111.                         this.set_screen_message("FINISH!");
  112.                      }
  113.  
  114.                      if (!this.checkGameOver()) {
  115.                         this.flag_repaint = true;
  116.                      }
  117.                   }
  118.                }
  119.  
  120.                if (this.flag_repaint) {
  121.                   this.draw();
  122.                   ((Canvas)this).repaint();
  123.  
  124.                   while(this.flag_repaint) {
  125.                      Thread.sleep(10L);
  126.                   }
  127.                }
  128.             }
  129.          } catch (Exception var4) {
  130.             System.out.println("In Run Exception " + var4);
  131.             ((Throwable)var4).printStackTrace();
  132.          }
  133.       }
  134.  
  135.    }
  136.  
  137.    void startNewGame() {
  138.       BlazingBoards.gameOverScreen = null;
  139.       System.gc();
  140.       this.position_across = 0;
  141.       this.position_along = 2;
  142.       this.height = this.height_relative = 0;
  143.       this.high_jump_board = false;
  144.       this.after_finish = false;
  145.       this.time_left_on_finish = 0L;
  146.       this.velocity_across = this.velocity_vertical = 0;
  147.       this.current_trick = 0;
  148.       this.current_frame = 0;
  149.       this.n_blaze_letters = 0;
  150.       this.on_fire = false;
  151.       this.g_force = 6;
  152.       this.tick = 0;
  153.       this.first_item_num = 0;
  154.       this.last_item_num = 0;
  155.       this.best_score.reset();
  156.       this.game_timeout = 150000L;
  157.       this.countDown = 4;
  158.       this.screen_message = null;
  159.       this.arrow_pressed = 0;
  160.       this.is_goofy = true;
  161.       System.out.println("GameConst.MAX_TRICKS " + GameConst.MAX_TRICKS);
  162.       System.out.println("reset");
  163.       this.game_start_time = System.currentTimeMillis();
  164.       this.now_time = this.game_start_time;
  165.       this.draw();
  166.    }
  167.  
  168.    public boolean checkGameOver() {
  169.       if (this.timeLeft() >= 0L) {
  170.          return false;
  171.       } else {
  172.          this.best_score.game_over(1);
  173.          return true;
  174.       }
  175.    }
  176.  
  177.    public void keyPressed(int var1) {
  178.       if (this.countDown <= 0) {
  179.          if (this.time_left_on_finish == 0L) {
  180.             if (this.current_trick == 0) {
  181.                if (var1 == this.getKeyCode_LEFT) {
  182.                   this.arrow_pressed = -1;
  183.                } else if (var1 == this.getKeyCode_RIGHT) {
  184.                   this.arrow_pressed = 1;
  185.                } else if (var1 == this.getKeyCode_UP) {
  186.                   if (this.height == 0) {
  187.                      this.do_trick(30);
  188.                   }
  189.                } else if (var1 == 49) {
  190.                   if (this.height_relative > 0) {
  191.                      this.do_trick(6);
  192.                   } else if (this.below_is_rail) {
  193.                      this.do_trick(13);
  194.                   } else {
  195.                      this.do_trick(19);
  196.                   }
  197.                } else if (var1 != 50 && var1 != this.getKeyCode_FIRE) {
  198.                   if (var1 == 51) {
  199.                      if (this.height_relative > 0) {
  200.                         this.do_trick(5);
  201.                      } else if (this.below_is_rail) {
  202.                         this.do_trick(12);
  203.                      } else {
  204.                         this.do_trick(22);
  205.                      }
  206.  
  207.                      return;
  208.                   }
  209.  
  210.                   if (var1 == 52) {
  211.                      if (this.height_relative > 0) {
  212.                         this.do_trick(8);
  213.                      } else if (this.below_is_rail) {
  214.                         this.do_trick(14);
  215.                      } else if (this.on_fire) {
  216.                         this.do_trick(21);
  217.                      } else {
  218.                         this.do_trick(20);
  219.                      }
  220.                   } else if (var1 == 53) {
  221.                      if (this.height_relative > 0) {
  222.                         if (this.on_fire) {
  223.                            this.do_trick(11);
  224.                         }
  225.                      } else if (this.below_is_rail) {
  226.                         if (this.on_fire) {
  227.                            this.do_trick(18);
  228.                         }
  229.                      } else {
  230.                         this.do_trick(29);
  231.                      }
  232.                   } else if (var1 == 54) {
  233.                      if (this.height_relative > 0) {
  234.                         this.do_trick(7);
  235.                      } else if (this.below_is_rail) {
  236.                         this.do_trick(15);
  237.                      } else if (this.on_fire) {
  238.                         this.do_trick(24);
  239.                      } else {
  240.                         this.do_trick(23);
  241.                      }
  242.                   } else if (var1 == 55) {
  243.                      if (this.height_relative > 0) {
  244.                         this.do_trick(9);
  245.                      } else if (this.below_is_rail) {
  246.                         this.do_trick(16);
  247.                      } else if (this.on_fire) {
  248.                         this.do_trick(27);
  249.                      } else {
  250.                         this.do_trick(25);
  251.                      }
  252.                   } else if (var1 == 56) {
  253.                      if (this.height_relative == 0 && !this.below_is_rail) {
  254.                         this.do_trick(3);
  255.                      }
  256.                   } else if (var1 == 57) {
  257.                      if (this.height_relative > 0) {
  258.                         this.do_trick(10);
  259.                      } else if (this.below_is_rail) {
  260.                         this.do_trick(17);
  261.                      } else if (this.on_fire) {
  262.                         this.do_trick(28);
  263.                      } else {
  264.                         this.do_trick(26);
  265.                      }
  266.                   } else if (var1 == 48 && this.height_relative == 0 && !this.below_is_rail) {
  267.                      this.do_trick(4);
  268.                   }
  269.                } else if (this.height_relative == 0 && this.current_trick == 0) {
  270.                   this.do_ollie();
  271.                }
  272.  
  273.             }
  274.          }
  275.       }
  276.    }
  277.  
  278.    public void keyReleased(int var1) {
  279.       if (this.tick >= 16) {
  280.          if (var1 == this.getKeyCode_LEFT || var1 == this.getKeyCode_RIGHT) {
  281.             this.arrow_pressed = 0;
  282.          }
  283.  
  284.       }
  285.    }
  286.  
  287.    public void do_trick(int var1) {
  288.       if (!this.after_finish) {
  289.          if (this.current_trick == 0) {
  290.             if (!this.high_jump_board) {
  291.                this.current_trick = var1;
  292.                this.current_frame = 0;
  293.                if (this.current_trick >= 18) {
  294.                   this.velocity_vertical = 41;
  295.                   ++this.height;
  296.                   ++this.height_relative;
  297.                   this.best_score.combo_enable();
  298.                }
  299.  
  300.                if (this.current_trick == 30) {
  301.                   this.high_jump_board = true;
  302.                } else {
  303.                   this.high_jump_board = false;
  304.                }
  305.  
  306.             }
  307.          }
  308.       }
  309.    }
  310.  
  311.    public void do_fall() {
  312.       if (this.current_trick != 2) {
  313.          this.current_trick = 2;
  314.          this.current_frame = 0;
  315.          if (!this.below_is_ramp && !this.below_is_rail) {
  316.             this.height = 0;
  317.          } else {
  318.             this.height = this.below_item_height;
  319.          }
  320.  
  321.          this.height_relative = 0;
  322.          this.velocity_vertical = 0;
  323.          this.set_screen_message(Info.trick_message[2]);
  324.          if (this.on_fire) {
  325.             this.on_fire = false;
  326.             this.g_force = 6;
  327.          }
  328.  
  329.          this.is_goofy = true;
  330.          this.high_jump_board = false;
  331.          this.best_score.combo_disable();
  332.       }
  333.    }
  334.  
  335.    public void do_ollie() {
  336.       if (!this.after_finish) {
  337.          this.velocity_vertical = 41;
  338.          ++this.height;
  339.          ++this.height_relative;
  340.          String var1 = "Ollie!+5";
  341.          int var2 = 5;
  342.          if (this.on_fire) {
  343.             var1 = var1 + "x2";
  344.             var2 *= 2;
  345.          }
  346.  
  347.          this.set_screen_message(var1);
  348.          this.best_score.add_score(var2);
  349.          this.best_score.combo_enable();
  350.       }
  351.    }
  352.  
  353.    public void do_grind() {
  354.       this.velocity_across = 0;
  355.       String var1 = "50-50 Grind!+10";
  356.       int var2 = 10;
  357.       if (this.on_fire) {
  358.          var1 = var1 + "x2";
  359.          var2 *= 2;
  360.       }
  361.  
  362.       this.high_jump_board = false;
  363.       this.set_screen_message(var1);
  364.       this.best_score.add_score(var2);
  365.    }
  366.  
  367.    public void nextTick() {
  368.       if (this.now_time - this.message_time > 3000L) {
  369.          this.message_time = 0L;
  370.          this.screen_message = null;
  371.       }
  372.  
  373.       if (this.current_trick != 0) {
  374.          ++this.current_frame;
  375.          if (this.current_frame > Info.trick_frames[this.current_trick]) {
  376.             if (Info.trick_score[this.current_trick] > 0) {
  377.                if (this.on_fire && !Info.trick_needs_fire[this.current_trick]) {
  378.                   this.set_screen_message(Info.trick_message[this.current_trick] + "x2");
  379.                   this.best_score.add_score(Info.trick_score[this.current_trick] * 2);
  380.                   this.best_score.add_combo(Info.trick_score[this.current_trick] * 2);
  381.                } else {
  382.                   this.set_screen_message(Info.trick_message[this.current_trick]);
  383.                   this.best_score.add_score(Info.trick_score[this.current_trick]);
  384.                   this.best_score.add_combo(Info.trick_score[this.current_trick]);
  385.                }
  386.             }
  387.  
  388.             if (this.current_trick == 6 || this.current_trick == 5 || this.current_trick == 9 || this.current_trick == 11) {
  389.                this.is_goofy = !this.is_goofy;
  390.             }
  391.  
  392.             BestScore.tricks_used[this.current_trick] = true;
  393.             this.current_trick = 0;
  394.             this.current_frame = 0;
  395.          }
  396.       }
  397.  
  398.       if (this.current_trick == 2) {
  399.          this.position_along += 20;
  400.       } else {
  401.          this.position_along += 95;
  402.       }
  403.  
  404.       this.strafe();
  405.  
  406.       while(this.first_item_num < GameConst.ITEM_COUNT && Info.trackItem[this.first_item_num][1] + Info.trackItem[this.first_item_num][4] <= this.position_along / 100) {
  407.          ++this.first_item_num;
  408.       }
  409.  
  410.       this.below_is_rail = false;
  411.       this.below_is_ramp = false;
  412.  
  413.       for(this.last_item_num = this.first_item_num; this.last_item_num < GameConst.ITEM_COUNT && Info.trackItem[this.last_item_num][1] < this.position_along / 100 + 20; ++this.last_item_num) {
  414.       }
  415.  
  416.       int var1 = this.first_item_num;
  417.  
  418.       while(var1 < GameConst.ITEM_COUNT) {
  419.          if (Info.trackItem[var1][1] > this.position_along / 100) {
  420.             var1 = GameConst.ITEM_COUNT;
  421.          } else {
  422.             if (this.position_across >= Info.trackItem[var1][2] && this.position_across <= Info.trackItem[var1][3]) {
  423.                break;
  424.             }
  425.  
  426.             ++var1;
  427.          }
  428.       }
  429.  
  430.       int var2 = 0;
  431.       int var3 = 0;
  432.       if (var1 < GameConst.ITEM_COUNT) {
  433.          int var4 = Info.trackItem[var1][0];
  434.          this.below_item_height = this.get_item_height(var1);
  435.          this.below_is_rail = var4 == 2;
  436.          this.below_is_ramp = var4 == 1;
  437.          var2 = Info.trackItem[var1][2];
  438.          var3 = Info.trackItem[var1][3];
  439.          if (var4 == 4) {
  440.             System.out.println("BONUS  height " + this.height + "  below_item_height " + this.below_item_height);
  441.             if (this.height < this.below_item_height) {
  442.                this.set_screen_message("Blaze icon!+25");
  443.                this.best_score.add_score(25);
  444.                this.add_blaze_letter();
  445.                this.first_item_num = var1 + 1;
  446.             }
  447.          } else if (var4 == 3) {
  448.             if (this.height < this.below_item_height) {
  449.                this.do_fall();
  450.             } else {
  451.                this.set_screen_message("Highbar Ollie!+30");
  452.                this.best_score.add_score(30);
  453.             }
  454.  
  455.             this.first_item_num = var1 + 1;
  456.          } else if (var4 == 5) {
  457.             this.set_screen_message("CHECKPOINT!");
  458.             this.add_time(30000L);
  459.             this.first_item_num = var1 + 1;
  460.          } else if (var4 == 6) {
  461.             this.first_item_num = var1 + 1;
  462.             this.time_left_on_finish = this.timeLeft();
  463.             this.after_finish = true;
  464.          } else if (var4 == 7) {
  465.             this.first_item_num = var1 + 1;
  466.             this.best_score.game_over(2);
  467.          }
  468.  
  469.          if (this.below_is_rail && this.height_relative == 0 && this.height < this.below_item_height) {
  470.             this.height_relative = 0;
  471.             this.height = this.below_item_height;
  472.             this.position_across = (var3 + var2) / 2;
  473.             this.do_grind();
  474.          }
  475.  
  476.          if (this.below_is_ramp && this.height_relative == 0 && this.height < this.below_item_height) {
  477.             this.height_relative = 0;
  478.             if (this.below_item_height - this.height > 30) {
  479.                this.do_fall();
  480.                this.velocity_across = 0 - this.velocity_across;
  481.             }
  482.  
  483.             this.height = this.below_item_height;
  484.          }
  485.       }
  486.  
  487.       if (this.height_relative > 0 || !this.below_is_rail && !this.below_is_ramp && this.height > 0) {
  488.          this.height += this.velocity_vertical;
  489.          this.velocity_vertical -= this.g_force;
  490.          if (!this.below_is_rail && !this.below_is_ramp) {
  491.             this.height_relative = this.height;
  492.          } else {
  493.             this.height_relative = this.height - this.below_item_height;
  494.          }
  495.  
  496.          if (this.height_relative <= 0) {
  497.             if (!this.below_is_rail && !this.below_is_ramp) {
  498.                this.height = 0;
  499.             } else {
  500.                this.height = this.below_item_height;
  501.             }
  502.  
  503.             this.height_relative = 0;
  504.             this.velocity_vertical = 0;
  505.             if (this.current_trick > 4 && this.current_frame <= Info.trick_frames[this.current_trick]) {
  506.                this.do_fall();
  507.                return;
  508.             }
  509.  
  510.             if (this.below_is_rail && this.current_trick != 2) {
  511.                if (this.high_jump_board) {
  512.                   this.do_fall();
  513.                   return;
  514.                }
  515.  
  516.                this.position_across = (var3 + var2) / 2;
  517.                this.do_grind();
  518.                this.do_trick(1);
  519.             } else {
  520.                this.high_jump_board = false;
  521.                this.do_trick(1);
  522.             }
  523.          }
  524.       }
  525.  
  526.       if (this.height_relative == 0 && this.best_score.combo_enabled) {
  527.          int var5 = this.best_score.get_result_combo();
  528.          if (var5 != 0) {
  529.             this.best_score.add_score(var5);
  530.             this.set_screen_message("Combo: +" + this.best_score.combo_score + "x" + this.best_score.combo_n_tricks);
  531.          }
  532.  
  533.          this.best_score.combo_disable();
  534.       }
  535.  
  536.    }
  537.  
  538.    public void strafe() {
  539.       if (this.arrow_pressed == -1 && !this.below_is_rail) {
  540.          if (this.velocity_across > 0) {
  541.             this.velocity_across = 0;
  542.          } else if (this.height_relative == 0) {
  543.             this.velocity_across = -8;
  544.          }
  545.       }
  546.  
  547.       if (this.arrow_pressed == 1 && !this.below_is_rail) {
  548.          if (this.velocity_across < 0) {
  549.             this.velocity_across = 0;
  550.          } else if (this.height_relative == 0) {
  551.             this.velocity_across = 8;
  552.          }
  553.       }
  554.  
  555.       if (this.arrow_pressed == 0) {
  556.          this.velocity_across = 0;
  557.       }
  558.  
  559.       this.position_across += this.velocity_across;
  560.       if (this.position_across > 44) {
  561.          this.position_across = 44;
  562.          this.velocity_across = 0;
  563.       }
  564.  
  565.       if (this.position_across < -44) {
  566.          this.position_across = -44;
  567.          this.velocity_across = 0;
  568.       }
  569.  
  570.    }
  571.  
  572.    public void set_screen_message(String var1) {
  573.       System.out.println("set_screen_message " + var1);
  574.       this.screen_message = var1;
  575.       this.message_time = this.now_time;
  576.    }
  577.  
  578.    public void add_blaze_letter() {
  579.       if (!this.on_fire) {
  580.          ++this.n_blaze_letters;
  581.          if (this.n_blaze_letters == 5) {
  582.             this.n_blaze_letters = 0;
  583.             this.on_fire = true;
  584.             this.g_force = 4;
  585.             this.set_screen_message("BLAZING ON FIRE!");
  586.          }
  587.  
  588.       }
  589.    }
  590.  
  591.    public long timeLeft() {
  592.       return this.time_left_on_finish != 0L ? this.time_left_on_finish : this.game_start_time + this.game_timeout - this.now_time;
  593.    }
  594.  
  595.    public void add_time(long var1) {
  596.       this.game_timeout += var1;
  597.    }
  598.  
  599.    public int get_item_height(int var1) {
  600.       return Info.trackItem[var1][0] == 1 ? this.ramp_height(this.position_along / 100 - Info.trackItem[var1][1], Info.trackItem[var1][4], Info.trackItem[var1][5]) : Info.trackItem[var1][5];
  601.    }
  602.  
  603.    public int ramp_height(int var1, int var2, int var3) {
  604.       return var1 > var2 ? 0 : var1 * var3 / var2;
  605.    }
  606.  
  607.    void drawClippedImage(Image var1, int var2, int var3, int var4, int var5, int var6, int var7) {
  608.       if (var2 < 101 && var2 + var6 > 0 && var6 > 0) {
  609.          this.imageBufferGraphics.setClip(var2, var3, var6, var7);
  610.          this.imageBufferGraphics.drawImage(var1, var2 - var4, var3 - var5, 20);
  611.       }
  612.    }
  613.  
  614.    void drawPlayerStanding(int var1, int var2, int var3, boolean var4) {
  615.       if (var3 >= 0 && var3 < 4) {
  616.          if (var4) {
  617.             var3 += 4;
  618.          }
  619.  
  620.          var1 -= 12;
  621.          var2 -= 32;
  622.          this.drawClippedImage(BlazingBoards.AllImage[2], var1, var2, 24 * var3, 0, 24, 32);
  623.       }
  624.  
  625.    }
  626.  
  627.    void drawPlayerTwisting(int var1, int var2, int var3) {
  628.       if (var3 >= 0 && var3 < 9) {
  629.          var1 -= 12;
  630.          var2 -= 32;
  631.          this.drawClippedImage(BlazingBoards.AllImage[0], var1, var2, 24 * var3, 0, 24, 32);
  632.       }
  633.  
  634.    }
  635.  
  636.    void drawPlayerFalling(int var1, int var2, int var3) {
  637.       if (var3 >= 0 && var3 < 8) {
  638.          var1 -= 15;
  639.          var2 -= 32;
  640.          this.drawClippedImage(BlazingBoards.AllImage[1], var1, var2, 30 * var3, 0, 30, 32);
  641.       }
  642.  
  643.    }
  644.  
  645.    void drawBoard(int var1, int var2, int var3, int var4) {
  646.       if (var3 >= 0 && var3 < 8) {
  647.          var1 -= 10;
  648.          var2 -= 16;
  649.          this.drawClippedImage(BlazingBoards.AllImage[3], var1, var2, 20 * var3, 16 * var4, 20, 16);
  650.       }
  651.  
  652.    }
  653.  
  654.    void drawFlame(int var1, int var2, int var3) {
  655.       if (var3 >= 0 && var3 < 2) {
  656.          var1 -= 12;
  657.          var2 -= 16;
  658.          this.drawClippedImage(BlazingBoards.AllImage[4], var1, var2, 24 * var3, 0, 24, 16);
  659.       }
  660.  
  661.    }
  662.  
  663.    void drawShadow(int var1, int var2) {
  664.       var1 -= 12;
  665.       var2 -= 16;
  666.       this.drawClippedImage(BlazingBoards.AllImage[4], var1, var2, 48, 0, 24, 16);
  667.    }
  668.  
  669.    public void draw() {
  670.       this.imageBufferGraphics.setFont(BlazingBoards.FontSmall);
  671.       this.imageBufferGraphics.setColor(255, 255, 255);
  672.       this.imageBufferGraphics.fillRect(0, 0, 101, 80);
  673.       this.imageBufferGraphics.drawImage(BlazingBoards.AllImage[5], 51, 1, 17);
  674.       this.draw_walls();
  675.  
  676.       for(int var1 = this.last_item_num - 1; var1 >= this.first_item_num; --var1) {
  677.          if (Info.trackItem[var1][0] == 1) {
  678.             this.draw_ramp(var1);
  679.          } else if (Info.trackItem[var1][0] == 2) {
  680.             this.draw_rail(var1);
  681.          } else if (Info.trackItem[var1][0] == 3) {
  682.             this.draw_bar(var1);
  683.          } else if (Info.trackItem[var1][0] == 4) {
  684.             this.draw_bonus(var1);
  685.          } else if (Info.trackItem[var1][0] == 5) {
  686.             this.draw_checkpoint(var1);
  687.          } else if (Info.trackItem[var1][0] == 6) {
  688.             this.draw_finish_line(var1);
  689.          }
  690.       }
  691.  
  692.       try {
  693.          this.drawPeople();
  694.       } catch (Exception var6) {
  695.          System.out.println("draw People ex = " + var6);
  696.       }
  697.  
  698.       this.imageBufferGraphics.setClip(0, 0, 101, 80);
  699.       this.imageBufferGraphics.setColor(0, 0, 0);
  700.       long var4 = this.timeLeft() / 1000L;
  701.       String var3 = Long.toString(var4 / 60L) + ":";
  702.       if (var4 % 60L < 10L) {
  703.          var3 = var3 + "0";
  704.       }
  705.  
  706.       var3 = var3 + Long.toString(var4 % 60L);
  707.       int var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
  708.       this.imageBufferGraphics.setColor(255, 255, 255);
  709.       this.imageBufferGraphics.fillRect(101 - var2 - 2, 14, var2 + 2, 14);
  710.       this.imageBufferGraphics.setColor(0, 0, 0);
  711.       this.imageBufferGraphics.drawString(var3, 101 - var2, 16, 20);
  712.       this.imageBufferGraphics.drawRect(101 - var2 - 2, 14, var2 + 2, 14);
  713.       this.imageBufferGraphics.setColor(0, 0, 0);
  714.       var3 = Integer.toString(this.best_score.getScore());
  715.       var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
  716.       this.imageBufferGraphics.setColor(255, 255, 255);
  717.       this.imageBufferGraphics.fillRect(0, 14, var2 + 2, 14);
  718.       this.imageBufferGraphics.setColor(0, 0, 0);
  719.       this.imageBufferGraphics.drawString(var3, 2, 16, 20);
  720.       this.imageBufferGraphics.drawRect(0, 14, var2 + 2, 14);
  721.       var3 = Integer.toString(this.n_blaze_letters);
  722.       var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
  723.       this.imageBufferGraphics.setColor(0, 0, 0);
  724.       this.imageBufferGraphics.fillRect(0, 28, var2 + 2, 14);
  725.       this.imageBufferGraphics.setColor(255, 255, 255);
  726.       this.imageBufferGraphics.drawString(var3, 2, 30, 20);
  727.       this.imageBufferGraphics.setColor(0, 0, 0);
  728.       this.imageBufferGraphics.drawRect(0, 28, var2 + 2, 14);
  729.       this.imageBufferGraphics.setColor(0, 0, 0);
  730.       if (this.screen_message != null) {
  731.          var2 = this.imageBufferGraphics.getFont().stringWidth(this.screen_message);
  732.          this.imageBufferGraphics.drawString(this.screen_message, 51, 2, 17);
  733.       }
  734.    }
  735.  
  736.    void drawPeople() {
  737.       int var1 = 51 + this.position_across;
  738.       int var2 = 80 - this.height / 5;
  739.       byte var3 = 80;
  740.       int var4 = 0;
  741.       int var5 = 0;
  742.       this.drawShadow(var1 + this.height / 5, var3);
  743.       if (this.current_trick == 2) {
  744.          this.drawPlayerFalling(var1, var2, this.current_frame);
  745.       } else {
  746.          if (this.on_fire) {
  747.             if (this.high_jump_board) {
  748.                int var6 = 0;
  749.                if (this.below_is_ramp) {
  750.                   var6 = this.below_item_height;
  751.                }
  752.  
  753.                this.drawFlame(var1, var3 - var6 / 5, this.tick & 1);
  754.             } else {
  755.                this.drawFlame(var1, var2, this.tick & 1);
  756.             }
  757.          }
  758.  
  759.          if (this.high_jump_board && this.height_relative > 0) {
  760.             int var21 = 0;
  761.             if (this.below_is_ramp) {
  762.                var21 = this.below_item_height;
  763.             }
  764.  
  765.             this.drawBoard(var1, var3 - var21 / 5, 0, 0);
  766.             if (this.is_goofy) {
  767.                this.drawPlayerTwisting(var1, var2, 0);
  768.             } else {
  769.                this.drawPlayerTwisting(var1, var2, 8);
  770.             }
  771.  
  772.          } else if (this.height_relative == 0 && this.current_trick < 2) {
  773.             var4 = (byte)0;
  774.             if (this.current_trick == 0) {
  775.                if (this.is_goofy) {
  776.                   if (this.velocity_across < 0) {
  777.                      var4 = (byte)1;
  778.                   }
  779.  
  780.                   if (this.velocity_across > 0) {
  781.                      var4 = (byte)2;
  782.                   }
  783.                } else {
  784.                   if (this.velocity_across < 0) {
  785.                      var4 = (byte)2;
  786.                   }
  787.  
  788.                   if (this.velocity_across > 0) {
  789.                      var4 = (byte)1;
  790.                   }
  791.                }
  792.             }
  793.  
  794.             if (this.current_trick == 1) {
  795.                var4 = (byte)3;
  796.             }
  797.  
  798.             this.drawPlayerStanding(var1, var2, var4, !this.is_goofy);
  799.          } else if (this.below_is_rail || this.current_trick != 3 && this.current_trick != 4) {
  800.             if (this.height_relative == 0 && this.below_is_rail && this.current_trick >= 12 && this.current_trick < 18) {
  801.                byte var20 = 0;
  802.                var4 = 1;
  803.                if (!this.is_goofy) {
  804.                   var4 = 5;
  805.                }
  806.  
  807.                if (this.current_trick == 16 && this.is_goofy || this.current_trick == 17 && this.is_goofy || this.current_trick == 12 && this.is_goofy || this.current_trick == 13 && !this.is_goofy) {
  808.                   if (this.current_frame < 3) {
  809.                      var4 += this.current_frame;
  810.                   } else if (this.current_frame > 5) {
  811.                      var4 += 7 - this.current_frame;
  812.                   } else {
  813.                      var4 += 2;
  814.                   }
  815.                }
  816.  
  817.                if (this.current_trick == 16 && !this.is_goofy || this.current_trick == 17 && !this.is_goofy || this.current_trick == 12 && !this.is_goofy || this.current_trick == 13 && this.is_goofy) {
  818.                   if (this.current_frame < 3) {
  819.                      var4 -= this.current_frame;
  820.                   } else if (this.current_frame > 5) {
  821.                      var4 -= 7 - this.current_frame;
  822.                   } else {
  823.                      var4 -= 2;
  824.                   }
  825.                }
  826.  
  827.                if (this.current_trick == 15) {
  828.                   var4 = 8;
  829.                   var20 = -3;
  830.                }
  831.  
  832.                if (this.current_trick == 16) {
  833.                   var20 = -3;
  834.                }
  835.  
  836.                if (this.current_trick == 17) {
  837.                   var20 = 3;
  838.                }
  839.  
  840.                if (this.current_trick == 14) {
  841.                   var4 = 2;
  842.                   var20 = 3;
  843.                }
  844.  
  845.                if (var4 > 8) {
  846.                   var4 -= 8;
  847.                }
  848.  
  849.                if (var4 < 1) {
  850.                   var4 += 8;
  851.                }
  852.  
  853.                this.drawPlayerTwisting(var1 + var20, var2, var4 - 1);
  854.                this.drawBoard(var1 + var20, var2, var4 - 1, 0);
  855.             } else if (this.height_relative > 0 && this.current_trick >= 5 && this.current_trick <= 11) {
  856.                var4 = 1;
  857.                if (!this.is_goofy) {
  858.                   var4 = 5;
  859.                }
  860.  
  861.                if (this.current_trick != 6 && this.current_trick != 8) {
  862.                   var4 += this.current_frame;
  863.                   if (var4 > 8) {
  864.                      var4 -= 8;
  865.                   }
  866.  
  867.                   if (var4 > 8) {
  868.                      var4 -= 8;
  869.                   }
  870.  
  871.                   if (var4 > 8) {
  872.                      var4 -= 8;
  873.                   }
  874.                } else {
  875.                   var4 -= this.current_frame;
  876.                   if (var4 < 1) {
  877.                      var4 += 8;
  878.                   }
  879.                }
  880.  
  881.                this.drawPlayerTwisting(var1, var2, var4 - 1);
  882.                this.drawBoard(var1, var2, var4 - 1, 0);
  883.             } else if (this.current_trick >= 18 && this.current_trick <= 21) {
  884.                var5 = (byte)1;
  885.                var5 += this.current_frame;
  886.                if (var5 > 8) {
  887.                   var5 -= 8;
  888.                }
  889.  
  890.                if (var5 > 8) {
  891.                   var5 -= 8;
  892.                }
  893.  
  894.                if (var5 > 8) {
  895.                   var5 -= 8;
  896.                }
  897.  
  898.                this.drawBoard(var1, var2, var5 - 1, 2);
  899.                if (this.is_goofy) {
  900.                   this.drawPlayerTwisting(var1, var2 - 12, 0);
  901.                } else {
  902.                   this.drawPlayerTwisting(var1, var2 - 12, 8);
  903.                }
  904.  
  905.             } else if (this.current_trick >= 22 && this.current_trick <= 24) {
  906.                var5 = 1;
  907.                var5 -= this.current_frame;
  908.                if (var5 < 1) {
  909.                   var5 += 8;
  910.                }
  911.  
  912.                if (var5 < 1) {
  913.                   var5 += 8;
  914.                }
  915.  
  916.                if (var5 < 1) {
  917.                   var5 += 8;
  918.                }
  919.  
  920.                this.drawBoard(var1, var2, var5 - 1, 2);
  921.                if (this.is_goofy) {
  922.                   this.drawPlayerTwisting(var1, var2 - 12, 0);
  923.                } else {
  924.                   this.drawPlayerTwisting(var1, var2 - 12, 8);
  925.                }
  926.  
  927.             } else if (this.current_trick >= 25 && this.current_trick <= 28) {
  928.                var5 = 1;
  929.                var5 += this.current_frame;
  930.                if (var5 > 8) {
  931.                   var5 -= 8;
  932.                }
  933.  
  934.                if (var5 > 8) {
  935.                   var5 -= 8;
  936.                }
  937.  
  938.                this.drawBoard(var1, var2, var5 - 1, 0);
  939.                if (this.is_goofy) {
  940.                   this.drawPlayerTwisting(var1, var2 - 12, 0);
  941.                } else {
  942.                   this.drawPlayerTwisting(var1, var2 - 12, 8);
  943.                }
  944.  
  945.             } else if (this.current_trick == 29) {
  946.                var5 = 1;
  947.                var5 += this.current_frame;
  948.                if (var5 > 8) {
  949.                   var5 -= 8;
  950.                }
  951.  
  952.                this.drawBoard(var1, var2, var5 - 1, 1);
  953.                if (this.is_goofy) {
  954.                   this.drawPlayerTwisting(var1, var2 - 12, 0);
  955.                } else {
  956.                   this.drawPlayerTwisting(var1, var2 - 12, 8);
  957.                }
  958.  
  959.             } else {
  960.                if (this.is_goofy) {
  961.                   this.drawBoard(var1, var2, 0, 0);
  962.                   this.drawPlayerTwisting(var1, var2, 0);
  963.                } else {
  964.                   this.drawBoard(var1, var2, 0, 4);
  965.                   this.drawPlayerTwisting(var1, var2, 8);
  966.                }
  967.  
  968.             }
  969.          } else {
  970.             var4 = 1;
  971.             if (!this.is_goofy) {
  972.                var4 = 5;
  973.             }
  974.  
  975.             if (this.current_trick == 3) {
  976.                if (this.current_frame % 2 == 0) {
  977.                   if (this.current_frame % 4 == 0) {
  978.                      --var4;
  979.                   } else {
  980.                      ++var4;
  981.                   }
  982.                }
  983.  
  984.                if (var4 > 8) {
  985.                   var4 -= 8;
  986.                }
  987.  
  988.                if (var4 < 1) {
  989.                   var4 += 8;
  990.                }
  991.             }
  992.  
  993.             if (this.current_trick == 4) {
  994.                if (this.current_frame < 4) {
  995.                   var4 += this.current_frame;
  996.                } else {
  997.                   var4 += 8 - this.current_frame;
  998.                }
  999.  
  1000.                if (var4 > 8) {
  1001.                   var4 -= 8;
  1002.                }
  1003.  
  1004.                if (var4 < 1) {
  1005.                   var4 += 8;
  1006.                }
  1007.             }
  1008.  
  1009.             this.drawPlayerTwisting(var1, var2, var4 - 1);
  1010.             this.drawBoard(var1, var2, var4 - 1, 0);
  1011.          }
  1012.       }
  1013.    }
  1014.  
  1015.    public int get_sx(int var1, int var2) {
  1016.       return (int)(51L + (long)var1 * 350L / (long)var2);
  1017.    }
  1018.  
  1019.    public int get_sy(int var1, int var2) {
  1020.       return (int)(35L + (long)(100 - var1 / 2) * 200L / (long)var2);
  1021.    }
  1022.  
  1023.    public void draw_vertical_line(int var1, int var2, int var3, int var4) {
  1024.       int var5 = this.get_sx(var4, var1);
  1025.       int var6 = this.get_sy(var3, var1);
  1026.       int var7 = this.get_sy(var2, var1);
  1027.       if (var5 >= 0 && var5 < 101) {
  1028.          this.imageBufferGraphics.drawLine(var5, var6, var5, var7);
  1029.          this.imageBufferGraphics.drawLine(101 - var5, var6, 101 - var5, var7);
  1030.       }
  1031.  
  1032.    }
  1033.  
  1034.    public void draw_walls() {
  1035.       Graphics var1 = this.imageBufferGraphics;
  1036.       this.imageBufferGraphics.setColor(0, 0, 0);
  1037.       int var2 = this.get_sy(0, 100);
  1038.       int var3 = this.get_sy(260, 100);
  1039.       int var4 = this.get_sy(0, 2000);
  1040.       int var5 = this.get_sy(260, 2000);
  1041.       int var10000 = var4 - var2;
  1042.       var10000 = var5 - var3;
  1043.  
  1044.       for(int var8 = -60; var8 <= 60; var8 += 120) {
  1045.          int var9 = this.get_sx(var8, 100);
  1046.          int var10 = this.get_sx(var8, 2000);
  1047.          if (var3 >= var5) {
  1048.             if (var10 <= 51) {
  1049.                this.imageBufferGraphics.drawLine(0, var5, var10, var5);
  1050.             }
  1051.  
  1052.             if (var10 >= 51) {
  1053.                this.imageBufferGraphics.drawLine(var10, var5, 101, var5);
  1054.             }
  1055.          }
  1056.  
  1057.          this.imageBufferGraphics.drawLine(var9, var3, var10, var5);
  1058.          this.imageBufferGraphics.drawLine(var9, var2, var10, var4);
  1059.          this.imageBufferGraphics.drawLine(var10, var5, var10, var4);
  1060.          this.imageBufferGraphics.drawLine(var10, var4, 51, var4);
  1061.       }
  1062.  
  1063.       int var13 = 0;
  1064.       int var15 = this.position_along / 100;
  1065.       int var11 = this.position_along % 100;
  1066.  
  1067.       for(int var12 = 3 - var15 % 3; var12 < 20; var12 += 3) {
  1068.          var13 = 100 * var12 - var11;
  1069.          this.draw_vertical_line(var13, 0, 260, -60);
  1070.       }
  1071.  
  1072.    }
  1073.  
  1074.    public void draw_ramp(int var1) {
  1075.       int var2 = this.position_along / 100 - 4;
  1076.       int var3 = this.position_along % 100;
  1077.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1078.       if (var4 <= 0) {
  1079.          var4 = 100;
  1080.       }
  1081.  
  1082.       int var5 = (Info.trackItem[var1][1] + Info.trackItem[var1][4] - var2) * 100 - var3;
  1083.       if (var5 > 2000) {
  1084.          var5 = 2000;
  1085.       }
  1086.  
  1087.       if (var5 > var4) {
  1088.          int var6 = this.get_sx(Info.trackItem[var1][2], var4);
  1089.          int var7 = this.get_sx(Info.trackItem[var1][3], var4);
  1090.          int var8 = this.get_sy(0, var4);
  1091.          int var9 = this.get_sx(Info.trackItem[var1][2], var5);
  1092.          int var10 = this.get_sx(Info.trackItem[var1][3], var5);
  1093.          int var11 = this.get_sy(0, var5);
  1094.          int var12 = this.get_sy(Info.trackItem[var1][5], var5);
  1095.          this.imageBufferGraphics.setColor(0, 0, 0);
  1096.          this.imageBufferGraphics.drawLine(var6, var8, var9, var11);
  1097.          this.imageBufferGraphics.drawLine(var7, var8, var10, var11);
  1098.          this.imageBufferGraphics.drawLine(var9, var11, var10, var11);
  1099.          this.imageBufferGraphics.drawLine(var9, var12, var9, var11);
  1100.          this.imageBufferGraphics.drawLine(var10, var12, var10, var11);
  1101.          this.imageBufferGraphics.setColor(255, 255, 255);
  1102.          int var13 = var8 - var12;
  1103.          int var14 = var6 - var9;
  1104.          int var15 = var7 - var10;
  1105.  
  1106.          for(int var16 = 0; var16 < var13 && var16 + var12 <= 80; ++var16) {
  1107.             this.imageBufferGraphics.drawLine(var9 + (int)((long)var16 * (long)var14 / (long)var13), var16 + var12, var10 + (int)((long)var16 * (long)var15 / (long)var13), var16 + var12);
  1108.          }
  1109.  
  1110.          this.imageBufferGraphics.setColor(0, 0, 0);
  1111.          this.imageBufferGraphics.drawLine(var6, var8, var7, var8);
  1112.          this.imageBufferGraphics.drawLine(var9, var12, var10, var12);
  1113.          this.imageBufferGraphics.drawLine(var6, var8, var9, var12);
  1114.          this.imageBufferGraphics.drawLine(var7, var8, var10, var12);
  1115.       }
  1116.    }
  1117.  
  1118.    public void draw_rail(int var1) {
  1119.       int var2 = this.position_along / 100 - 4;
  1120.       int var3 = this.position_along % 100;
  1121.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1122.       if (var4 <= 0) {
  1123.          var4 = 100;
  1124.       }
  1125.  
  1126.       int var5 = (Info.trackItem[var1][1] + Info.trackItem[var1][4] - var2) * 100 - var3;
  1127.       if (var5 > 2000) {
  1128.          var5 = 2000;
  1129.       }
  1130.  
  1131.       if (var5 > var4) {
  1132.          int var6 = (Info.trackItem[var1][2] + Info.trackItem[var1][3]) / 2;
  1133.          int var7 = this.get_sx(var6, var4);
  1134.          int var8 = this.get_sx(var6, var5);
  1135.          int var9 = this.get_sy(0, var4);
  1136.          int var10 = this.get_sy(Info.trackItem[var1][5], var4);
  1137.          int var11 = this.get_sy(0, var5);
  1138.          int var12 = this.get_sy(Info.trackItem[var1][5], var5);
  1139.          this.imageBufferGraphics.setColor(90, 90, 90);
  1140.          this.imageBufferGraphics.drawLine(var7, var9, var8, var11);
  1141.          this.imageBufferGraphics.setColor(0, 0, 0);
  1142.          this.imageBufferGraphics.drawLine(var7, var10, var8, var12);
  1143.          this.imageBufferGraphics.drawLine(var7 - 1, var10, var8 - 1, var12);
  1144.          this.imageBufferGraphics.drawLine(var7 + 1, var10, var8 + 1, var12);
  1145.          this.imageBufferGraphics.drawLine(var7, var10, var7, var9);
  1146.          this.imageBufferGraphics.drawLine(var8, var12, var8, var11);
  1147.       }
  1148.    }
  1149.  
  1150.    public void draw_bonus(int var1) {
  1151.       int var2 = this.position_along / 100 - 4;
  1152.       int var3 = this.position_along % 100;
  1153.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1154.       if (var4 <= 0) {
  1155.          var4 = 100;
  1156.       }
  1157.  
  1158.       int var5 = this.get_sx(Info.trackItem[var1][2], var4);
  1159.       int var6 = this.get_sx(Info.trackItem[var1][3], var4);
  1160.       int var7 = this.get_sy(0, var4);
  1161.       int var8 = this.get_sy(Info.trackItem[var1][5], var4);
  1162.       this.imageBufferGraphics.setColor(255, 255, 255);
  1163.       int var9 = var6 - var5;
  1164.       int var10 = var7 - var8;
  1165.       this.imageBufferGraphics.fillRect(var5, var8, var9, var10);
  1166.       this.imageBufferGraphics.setColor(0, 0, 0);
  1167.       this.imageBufferGraphics.drawRect(var5, var8, var9, var10);
  1168.       if (var10 > 7) {
  1169.          this.imageBufferGraphics.setColor(0, 0, 0);
  1170.          this.imageBufferGraphics.drawLine(var5 + 2, var8 + 2, var5 + 2, var7 - 2);
  1171.          this.imageBufferGraphics.drawLine(var5 + 2, var8 + 2, var5 + var10 / 2, var8 + 2);
  1172.          this.imageBufferGraphics.drawLine(var5 + 2, var7 - 2, var5 + var10 / 2, var7 - 2);
  1173.          this.imageBufferGraphics.drawLine(var5 + 2, var8 + var10 / 2, var5 + var10 / 2, var8 + 2);
  1174.          this.imageBufferGraphics.drawLine(var5 + 2, var8 + var10 / 2, var5 + var10 / 2, var7 - 2);
  1175.       }
  1176.  
  1177.    }
  1178.  
  1179.    public void draw_bar(int var1) {
  1180.       int var2 = this.position_along / 100 - 4;
  1181.       int var3 = this.position_along % 100;
  1182.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1183.       if (var4 <= 0) {
  1184.          var4 = 100;
  1185.       }
  1186.  
  1187.       int var5 = this.get_sx(Info.trackItem[var1][2], var4);
  1188.       int var6 = this.get_sx(Info.trackItem[var1][3], var4);
  1189.       int var7 = this.get_sy(0, var4);
  1190.       int var8 = this.get_sy(Info.trackItem[var1][5], var4);
  1191.       this.imageBufferGraphics.setColor(90, 90, 90);
  1192.       this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
  1193.       this.imageBufferGraphics.drawLine(var5, var7, var5, var8);
  1194.       this.imageBufferGraphics.drawLine(var6, var7, var6, var8);
  1195.       this.imageBufferGraphics.setColor(0, 0, 0);
  1196.       this.imageBufferGraphics.drawLine(var5, var8, var6, var8);
  1197.       if (var7 - var8 > 10) {
  1198.          this.imageBufferGraphics.drawLine(var5, var8 - 1, var6, var8 - 1);
  1199.       }
  1200.  
  1201.       if (var7 - var8 > 20) {
  1202.          this.imageBufferGraphics.drawLine(var5, var8 + 1, var6, var8 + 1);
  1203.       }
  1204.  
  1205.    }
  1206.  
  1207.    public void draw_checkpoint(int var1) {
  1208.       int var2 = this.position_along / 100 - 4;
  1209.       int var3 = this.position_along % 100;
  1210.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1211.       if (var4 <= 0) {
  1212.          var4 = 100;
  1213.       }
  1214.  
  1215.       int var5 = this.get_sx(Info.trackItem[var1][2], var4);
  1216.       int var6 = this.get_sx(Info.trackItem[var1][3], var4);
  1217.       int var7 = this.get_sy(0, var4);
  1218.       this.imageBufferGraphics.setColor(90, 90, 90);
  1219.       this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
  1220.       if (var4 < 1000) {
  1221.          this.imageBufferGraphics.drawLine(var5, var7 - 1, var6, var7 - 1);
  1222.       }
  1223.  
  1224.       if (var4 < 500) {
  1225.          this.imageBufferGraphics.drawLine(var5, var7 + 1, var6, var7 + 1);
  1226.       }
  1227.  
  1228.    }
  1229.  
  1230.    public void draw_finish_line(int var1) {
  1231.       int var2 = this.position_along / 100 - 4;
  1232.       int var3 = this.position_along % 100;
  1233.       int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
  1234.       if (var4 <= 0) {
  1235.          var4 = 100;
  1236.       }
  1237.  
  1238.       int var5 = this.get_sx(Info.trackItem[var1][2], var4);
  1239.       int var6 = this.get_sx(Info.trackItem[var1][3], var4);
  1240.       int var7 = this.get_sy(0, var4);
  1241.       this.imageBufferGraphics.setColor(0, 0, 0);
  1242.       this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
  1243.       if (var4 < 1000) {
  1244.          this.imageBufferGraphics.drawLine(var5, var7 - 1, var6, var7 - 1);
  1245.       }
  1246.  
  1247.       if (var4 < 500) {
  1248.          this.imageBufferGraphics.drawLine(var5, var7 + 1, var6, var7 + 1);
  1249.       }
  1250.  
  1251.    }
  1252. }
  1253.